package com.hjj.formatter;

import org.springframework.format.FormatterRegistrar;
import org.springframework.format.FormatterRegistry;

public class MyFormatterRegistrar implements FormatterRegistrar {
    private String datePatter;
    private String errorMsg;

    public MyFormatterRegistrar(String datePatter, String errorMsg) {
        this.datePatter = datePatter;
        this.errorMsg = errorMsg;
    }

    @Override
    public void registerFormatters(FormatterRegistry registry) {
        registry.addFormatter(new MyDateFormatter(datePatter, errorMsg));
    }
}
